package com.bookstore.bauhinia.category.service.impl;

import com.bookstore.bauhinia.category.service.CategoryService;
import com.bookstore.bauhinia.mapper.CategoryMapper;
import com.bookstore.bauhinia.pojo.Category;
import com.bookstore.bauhinia.pojo.CategoryExample;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public Category selectByPrimaryKey(Integer id) {
        return categoryMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insert(Category record) {
        return categoryMapper.insert(record);
    }

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return categoryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKey(Category record) {
        return categoryMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Category> getAllCategories() {
        return categoryMapper.selectByExample(new CategoryExample());
    }

}